package ym.ecrm.core.domain.financeManagement;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import ym.ecrm.core.domain.base.BaseEntity;
import ym.ecrm.core.domain.systemManagement.User;

/**
 * 管理付款类
 * @author fage
 *version 1.0
 */
@Entity
@Table(name ="t_payment")
public class Payment extends BaseEntity{
	
	/**
	 * paymentCode 付款记录编号
	 */
	private String paymentCode;
	/**
	 * 
	 */
	@OneToMany(targetEntity=AccountsPayable.class
			,cascade = {CascadeType.PERSIST,CascadeType.MERGE}
			,fetch =FetchType.EAGER )
	@JoinColumn(name ="paymentId")
	private Set<AccountsPayable> accountsPayables = new HashSet<AccountsPayable>();
	
	/**
	 * target 付款对象
	 */
	private String target;
	/**
	 * sum 金额
	 */
	private String sum;
	/**
	 * lastPayTime 最后付款时间
	 */
	private String lastPayTime;
	/**
	 * user 经手人
	 */
	@ManyToOne(targetEntity = User.class
			, cascade = {CascadeType.PERSIST, CascadeType.MERGE })
	@JoinColumn(name = "userId")
	private User user;
	
	
	
	public String getPaymentCode() {
		return paymentCode;
	}
	public void setPaymentCode(String paymentCode) {
		this.paymentCode = paymentCode;
	}
	public Set<AccountsPayable> getAccountsPayables() {
		return accountsPayables;
	}
	public void setAccountsPayables(Set<AccountsPayable> accountsPayables) {
		this.accountsPayables = accountsPayables;
	}
	public String getTarget() {
		return target;
	}
	public void setTarget(String target) {
		this.target = target;
	}
	public String getSum() {
		return sum;
	}
	public void setSum(String sum) {
		this.sum = sum;
	}
	public String getLastPayTime() {
		return lastPayTime;
	}
	public void setLastPlayTime(String lastPayTime) {
		this.lastPayTime = lastPayTime;
	}
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}

	
	
}
